add_all

function add_all(index: integer, values: collection<-T>): boolean

Insert all elements from a collection at the specified index. Any elements previously occurring at and after the specified index have their indices increased by the size of the given collection. The size of the list increases by the size of the given collection.

Note that for a list my_list:

  • my_list.add_all(my_list.size(), x) "appends" the elements of the collection x to the end of the list

  • my_list.add_all(my_list.size() + 1, x) throws an exception

Note also that my_list.add_all(my_list.size(), x) is equivalent to my_list.add_all(x) (inherited from collection<T>).

Return

true

Since

0.9.0

Parameters

index

the starting index at which to add the elements

values

the collection containing elements to add

Throws

exception

if the specified index is out of bounds


function add_all(values: collection<-T>): boolean

Add all elements from another collection to the end of this collection.

If this collection does not allow duplicates, then only those elements not already contained in this collection are added.

Return

true if any elements were added to this collection, false if it was not modified

Since

0.9.0

Parameters

values

the collection of elements to add